package com.design;

/**
 * JSON格式的访问者
 */
public class JsonReportVisitor implements ReportVisitor {
    @Override
    public void visitUserReport(UserReport userReport) {
        System.out.println("JSON格式的用户行：" + userReport.getName() + "," + userReport.getAge() + "," + userReport.getAddress());
    }

    @Override
    public void visitSaleReport(SaleReport saleReport) {
        System.out.println("JSON格式的销售行：" + saleReport.getProductName() + "," + saleReport.getPrice() + "," + saleReport.getQuantity());
    }
}
